<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			// 删除有序数组中的重复项
			/**
			 * @param {number[]} nums
			 * @return {number}
			 */
			var removeDuplicates = function(nums) {
				for (let i = 0; i < nums.length; i++) {
					if (nums[i] == nums[i + 1]) {
						nums.splice(i + 1, 1);
						i--;
					}
				}
				return nums.length;
			};
			console.log(removeDuplicates([1, 1, 2]));
		</script>
	</body>
</html>
